package com.xxrl.shop.common.utils;

import com.xxrl.shop.common.entity.JsonResult;
import com.xxrl.shop.common.entity.ResultCode;

import java.io.Serializable;

/**
 * @author mis
 */
public class ResultTool {

    private ResultTool() {}

    public static JsonResult<String> success() {
        return new JsonResult<>(true);
    }

    public static <T extends Serializable> JsonResult<T> success(T data) {
        return new JsonResult<>(true, data);
    }

    public static JsonResult<String> fail() {
        return new JsonResult<>(false);
    }
    public static <T extends Serializable> JsonResult<T> fail(T data) {
        return new JsonResult<>(false,data);
    }

    public static JsonResult<String> fail(ResultCode resultEnum) {
        return new JsonResult<>(false, resultEnum);
    }

}
